package cn.weekimwee.firstlineofcodeforkotlin.unit2

import android.os.Bundle
import android.util.Log
import cn.weekimwee.firstlineofcodeforkotlin.BaseActivity
import cn.weekimwee.firstlineofcodeforkotlin.R
import kotlinx.android.synthetic.main.activity_sing_top.*
import org.jetbrains.anko.startActivity

/**
 * 如果该活动已在栈顶，则直接启动它，不会重新创建新的实例
 */
class SingleTopActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sing_top)
        val TAG = this@SingleTopActivity::class.java.simpleName
        Log.e(TAG, "$TAG is create")
        button.setOnClickListener { startActivity<SingleTopActivity>() }
        button2.setOnClickListener { startActivity<FirstActivity>() }
    }
}
